package com.wangdao.wechatmall.util;

/**
 * @ClassName: BooleanTransformUtils
 * @Description deleted/checked变量为Boolean和Integer之间的兼容性转换
 * @Author Xinhao Yi
 * @Date 2021/7/11  14:42
 */
public class BooleanTransformUtils {

    //Boolean ---> Integer
    public static Integer deletedBoolean2Integer(Boolean deleted){
        //false
        if (deleted){
            return 0;
        }
        //true
        else{
            return 1;
        }
    }

    public static Boolean deletedInteger2Boolean(Integer deleted){
        //0----->false
        //1----->true
        return deleted != 0;
    }

    //Boolean ---> Integer
    public static Integer checkedBoolean2Integer(Boolean checked){
        //false
        if (checked){
            return 0;
        }
        //true
        else{
            return 1;
        }
    }

    public static Boolean checkedInteger2Boolean(Integer checked){
        //0----->false
        //1----->true
        return checked != 0;
    }


}
